package com.woyou.ui.activity;

import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.Click;
import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.ViewById;

import android.content.Context;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.citaq.ideliver.R;
import com.umeng.socialize.bean.SHARE_MEDIA;
import com.umeng.socialize.controller.UMSocialService;
import com.woyou.utils.Dialog;
import com.woyou.utils.ShareUtils;

/**
 * 设置SetUpFragment
 * 
 * @author tanglc
 */
@EActivity(R.layout.fm_about)
public class MyAboutActivity extends BaseActivity {

	Dialog dialog = new Dialog();

	@ViewById // 意见反馈、分享好友、欢迎页面、使用条款
	LinearLayout fm_about_feedbackbtn, fm_about_sharebtn, fm_about_welcomebtn, fm_about_termsbtn, coveronclick;
	@ViewById // 退出关于我们界面
	RelativeLayout myback;
	@ViewById // 标题文本
	TextView head_title, about_copyright, about_title;

	private InputMethodManager imm; // 软键盘

	@AfterViews
	public void init() {
		initView();
	}
	
	@Override
	public void onResume() {
		super.onResume();
		imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
		if (mActivity.getCurrentFocus() != null) {
			imm.hideSoftInputFromWindow(mActivity.getCurrentFocus().getWindowToken(),
					InputMethodManager.HIDE_NOT_ALWAYS);
		}
	}
	
	/**
	 * 初始化View
	 */
	private void initView() {
		head_title.setText("关于我有");
		about_title.setText("上海我有信息科技有限公司");
		about_copyright.setText("©2015 Shanghai I Deliver Technology Co., Ltd");
	}

	// 意见反馈、分享好友、欢迎页面、使用条款
	@Click({ R.id.myback, R.id.fm_about_feedbackbtn, R.id.fm_about_welcomebtn, R.id.fm_about_sharebtn,
			R.id.fm_about_termsbtn, R.id.coveronclick })
	void loginOnClick(View view) {
		switch (view.getId()) {
		case R.id.myback:
			// 退出关于我们界面
			finish();
			break;
			
		case R.id.fm_about_feedbackbtn:
			// 意见反馈
			openActivity(FeedBackActivity_.class, null);
			break;
			
		case R.id.fm_about_sharebtn:
			// 分享好友
			ShareUtils shareUtils = ShareUtils.getInstance(this);
			UMSocialService mController = shareUtils.getmController();
			shareUtils.setShareApp();
			mController.getConfig().setPlatforms(SHARE_MEDIA.WEIXIN, SHARE_MEDIA.WEIXIN_CIRCLE, SHARE_MEDIA.QQ,
					SHARE_MEDIA.QZONE, SHARE_MEDIA.SINA);
			mController.openShare(this, false);
			break;
			
		case R.id.fm_about_welcomebtn:
			// 欢迎页面
			openActivity(WelcomeActivity.class, null);
			break;
			
		case R.id.fm_about_termsbtn:
			// 使用条款欢迎页面
			openActivity(AgreementActivity_.class, null);
			break;
			
		case R.id.coveronclick:
			break;
		default:
			break;
		}
	}

	@Override
	public boolean backOperate() {
		// TODO Auto-generated method stub
		return false;
	}

}
